package com.ppc.mapper.employer;

import com.github.pagehelper.Page;
import com.ppc.dto.EmployerRequireModifyDTO;
import com.ppc.dto.EmployerRequirePageQueryDTO;
import com.ppc.entity.Requirement;
import com.ppc.vo.EmployerPageQueryVO;
import com.ppc.vo.EmployerRequireDetailVO;
import com.ppc.vo.EmployerTagVO;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * 雇主需求mapper层
 *
 * @author LENOVO
 * @date 2023/12/20
 */
@Mapper
public interface EmployerRequireMapper {

  /**
   * 创建需求
   *
   * @param requirement
   */
  Long createRequirement(Requirement requirement);

  /**
   * 修改需求
   *
   * @param employerRequireModifyDTO
   */
  Long update(EmployerRequireModifyDTO employerRequireModifyDTO);

  /**
   * 查看需求详细信息
   *
   * @param requireId
   * @return
   */
  EmployerRequireDetailVO checkRequireDetail(Long requireId);

  /**
   * 雇主删除需求
   *
   * @param requireId
   */
  @Delete("delete from requirement where require_id = #{requireId}")
  void requireDel(Long requireId);

  /**
   * 分页查询需求
   * @param requireStatus
   * @param requireTitle
   * @param employerId
   * @return
   */
  Page<EmployerPageQueryVO> pageQuery(String requireStatus,String requireTitle,Long employerId);

  /**
   * 根据需求id查询需求
   *
   * @param requireId
   * @return
   */
  @Select("select * from requirement where require_id = #{requireId}")
  Requirement getById(Long requireId);

  /**
   * 获取雇主id
   * @param userId
   * @return
   */
  @Select("select employer_id from employer where user_id=#{userId}")
  Long getEmployerIdByUserId(Long userId);

  /**
   * 查看需求标签
   *
   * @return
   */
  List<EmployerTagVO> getRequireTag();
}
